Remove observabilityEnabled check to include icp.runtimeId#1446
Remove observabilityEnabled check to include icp.runtimeId#1446daneshk merged 2 commits intoballerina-platform:masterfrom
Conversation
📝 WalkthroughWalkthroughThe change removes the observability provider check guarding ICP runtime ID retrieval in the root logger. The runtime ID is now unconditionally extracted and included in log records when available, ensuring it appears in logs regardless of observability configuration. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (78.22%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #1446 +/- ##
=========================================
Coverage 78.22% 78.22%
Complexity 97 97
=========================================
Files 9 9
Lines 620 620
Branches 116 116
=========================================
Hits 485 485
Misses 100 100
Partials 35 35 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
| if runtimeId is string { | ||
| logRecord[ICP_RUNTIME_ID_KEY] = runtimeId; | ||
| } | ||
| string? runtimeId = observe:getTagValue(ICP_RUNTIME_ID_KEY); |
There was a problem hiding this comment.
Without observability enabled, do we get this tag value? If so why the tag is exposed in observe API instead of a runtime API?
There was a problem hiding this comment.
The issue is that isObservabilityEnabled() check becomes true only if any observability provider is set. Otherwise, it remains false even if we have enabled observability in Ballerina.toml



Purpose
ICP runtimeId should print even if any observability provider is not set. Otherwise we cannot filter runtime logs on ICP.
Fixes ballerina-platform/ballerina-library#8648
Examples
Checklist
Summary
This pull request modifies the logging behavior to ensure that the ICP runtimeId is consistently included in application logs, regardless of whether an observability provider is configured. The change removes a conditional check that previously guarded the runtimeId extraction, allowing the runtime identifier to be captured and added to log records unconditionally whenever available. This improvement enables developers to filter and trace runtime logs using the runtimeId identifier, enhancing log filtering and application troubleshooting capabilities.
Changes Made
ballerina/root_logger.balto unconditionally retrieve and include the ICP runtimeId in log records, independent of observability provider configuration status.